import {defHttp} from '/@/utils/http/axios';
import { Modal } from "ant-design-vue";

export enum Api {
  bankById     = "/bank/queryById",
  bankSave     = "/bank/save",
  bankList     = "/bank/list",
  bankTransfer = "/bank/transfer",
  bankDataGrid = "/bank/dataGrid",

  bankRunningSave   = '/bankRunning/save',
  bankRunninglist   = '/bankRunning/list',
  bankRunningById   = '/bankRunning/queryById',
  bankRunningdelete = '/bankRunning/delete',

  //导入导出
  exportXls = '/bankRunning/exportXls',
  importXls = '/bankRunning/importExcel',

  //支出流水
  bankBalancelist   = '/bankBalance/list',
  bankBalancedelete = '/bankBalance/delete',


  //生成对账 - 数据 2025-07-25
  createBalanceDataReport = '/bankRunningReport/createBalanceDataReport',

  //一、集团账户
  findBalanceRealList = '/bankRunningReportReal/findBalanceRealList',
  findBalanceDayReal  = '/bankRunningReportReal/findBalanceDay',
  findBalanceDataReal = '/bankRunningReportReal/findBalanceDataReal',

  //二、国内分账，三、国际账户 
  findBalanceReport = '/bankRunningReport/findBalanceReport',

  findBalanceListBranch = '/bankRunningReportBranch/findBalanceList',
  findBalanceDayBranch  = '/bankRunningReportBranch/findBalanceDay',
  findBalanceDataBranch = '/bankRunningReportBranch/findBalanceData',

  //四、国内账户 2025-08-20
  departBalanceList = '/bankRunningReportDepart/departBalanceList',
  departBalanceDay  = '/bankRunningReportDepart/departBalanceDay',
  departBalanceData = '/bankRunningReportDepart/departBalanceData',
  
  //流水
  bankBusinesslist = '/bankBusiness/list',

  //分解
  bankDecomposeList   = '/bankBusiness/decomposeList',
  bankDecomposeSave   = '/bankBusiness/save',
  bankDecomposeDelete = '/bankBusiness/delete',
  bankDecomposeById   = '/bankBusiness/queryDecomposeById',
  bankDecomposeCheck  = '/bankBusiness/decomposeCheck',

  //清洗 -- 2025-10-29
  bankBalanceClear  = '/bankRunningClear/clear',
  //更新 系统对账 - 系统流水 & 银行流水 - 
  bankBalanceUpdate = '/bankRunningClear/update',

  findBalanceCheckAnalyse = "/bankRunningClear/findBalanceCheckAnalyse",
}

/**
 * 导出api
 * @param params
 */
export const getExportUrl = Api.exportXls;

/**
 * 导入api
 */
export const getImportUrl = Api.importXls;

/**
 * 银行账号 - 列表
 * @param params
 */
export const bankList = (params?) => defHttp.get({url: Api.bankList, params});

/**
 * 银行账号 - 列表
 * @param params
 */
export const bankDataGrid = (params) => defHttp.get({url: Api.bankDataGrid, params});

/**
 * 银行账号 - 通过ID获取数据
 * @param params
 */
export const bankById = (params) => defHttp.get({url: Api.bankById, params});

/**
 * 银行账号 - 保存或者更新
 * @param params
 */
export const bankSave = (params) => {
  return defHttp.post({url: Api.bankSave, params}, {isTransformResponse:false});
}

/**
 * 银行账号 - 银行划转
 * @param params
 */
export const bankTransfer = (params) => {
  return defHttp.post({url: Api.bankTransfer, params}, {isTransformResponse:false});
}

/**
 * 银行流水 - 列表
 * @param params
 */
export const bankRunninglist = (params) => defHttp.get({url: Api.bankRunninglist, params, timeout: 60000});

/**
 * 银行流水 - 保存或者更新
 * @param params
 */
export const bankRunningSave = (params) => {
  return defHttp.post({url: Api.bankRunningSave, params}, {isTransformResponse:false});
}

/**
 * 银行流水 - 通过ID获取数据
 * @param params
 */
export const bankRunningById = (params) => defHttp.get({url: Api.bankRunningById, params});

/**
 * 银行流水 - 通过ID删除数据
 * @param params
 */
export const deleteBankRunning = (params, handleSuccess) => {
  Modal.confirm({
    title: '确认删除',
    content: '是否删除选中数据',
    okText: '确认',
    cancelText: '取消',
    onOk: () => {
      return defHttp.delete({ url: Api.bankRunningdelete, data: params }, { joinParamsToUrl: true }).then(() => {
        handleSuccess();
      });
    },
  });
}

/**
 * 支出流水 - 列表
 * @param params
 */
export const bankBalancelist = (params) => defHttp.get({url: Api.bankBalancelist, params});


/**
 * 支出流水 - 通过ID删除数据
 * @param params
 */
export const bankBalanceDelete = (params, handleSuccess) => {
  Modal.confirm({
    title: '确认删除',
    content: '是否删除选中数据',
    okText: '确认',
    cancelText: '取消',
    onOk: () => {
      return defHttp.delete({ url: Api.bankBalancedelete, data: params }, { joinParamsToUrl: true }).then(() => {
        handleSuccess();
      });
    },
  });
}

/**
 * 银行流水 - 列表
 * @param params
 */
export const bankBusinesslist = (params) => defHttp.get({url: Api.bankBusinesslist, params});

/**
 * 银行流水 - 分解数据列表
 * @param params
 */
export const bankDecomposeList = (params) => defHttp.get({url: Api.bankDecomposeList, params});

/**
 * 银行流水 - 保存或者更新
 * @param params
 */
export const bankDecomposeSave = (params) => {
  return defHttp.post({url: Api.bankDecomposeSave, params}, {isTransformResponse:false});
}

/**
 * 银行流水 - 通过ID获取数据
 * @param params
 */
export const bankDecomposeById = (params) => defHttp.get({url: Api.bankDecomposeById, params});

/**
 * 银行流水 - 通过ID删除数据
 * @param params
 */
export const bankDecomposeDelete = (params, handleSuccess) => {
  Modal.confirm({
    title: '确认删除',
    content: '是否删除选中数据',
    okText: '确认',
    cancelText: '取消',
    onOk: () => {
      return defHttp.delete({ url: Api.bankDecomposeDelete, data: params }, { joinParamsToUrl: true }).then(() => {
        handleSuccess();
      });
    },
  });
}

/**
 * 分解金额检查
 * @param params
 */
export const bankDecomposeCheck = (params) => defHttp.get({
  url: Api.bankDecomposeCheck,
  params
}, { isTransformResponse: false });

/**
 * 对账数据 - 集团账户 2025-05-25
 * @param params
 */
export const findBalanceReport = (params) => defHttp.get({ url: Api.findBalanceReport, params, timeout: 60000 }, { isTransformResponse: false });

/**
 * 对账数据 2025-05-25
 * @param params
 */
export const createBalanceDataReport = (params) => defHttp.get({ url: Api.createBalanceDataReport, params, timeout: 60000 }, { isTransformResponse: false });

/**
 * 一、集团账户 - 收支日期 - 系统数据
 * 2025-05-25
 * @param params
 */
export const findBalanceRealList = (params) => defHttp.get({ url: Api.findBalanceRealList, params });

/**************************************************************************************
 * 一、集团账户 - 收支日期 - 统计列表 
 * 2025-08-25
 * @param params
 */
export const findBalanceDayReal = (params) => defHttp.get({ url: Api.findBalanceDayReal, params });

/**
 * 一、集团账户 - 收支日期 - 详细信息
 * 2025-05-25
 * @param params
 */
export const findBalanceDataReal = (params) => defHttp.get({ url: Api.findBalanceDataReal, params}, { isTransformResponse: false });


/** ************************************************************************************
 * 二、部门分账 - 收支日期 - 统计列表 
 * 2025-05-25
 * @param params
 */
export const findBalanceListBranch = (params) => defHttp.get({ url: Api.findBalanceListBranch, params });

/**
 * 二、部门分账 - 收支日期 - 详细信息
 * 2025-05-25
 * @param params
 */
export const findBalanceDayBranch = (params) => defHttp.get({ url: Api.findBalanceDayBranch, params });

/**
 * 二、部门分账 - 收支日期 - 详细信息
 * 2025-05-25
 * @param params
 */
export const findBalanceDataBranch = (params) => defHttp.get({ url: Api.findBalanceDataBranch, params}, { isTransformResponse: false });


/** ************************************************************************************
 * 四、国内账号 - 收支对账 - 统计列表 
 * 2025-08-25
 * @param params
 */
export const departBalanceList = (params) => defHttp.get({ url: Api.departBalanceList, params });

/**
 * 四、国内账号 - 收支日期 - 详细信息
 * 2025-05-25
 * @param params
 */
export const departBalanceDay = (params) => defHttp.get({ url: Api.departBalanceDay, params });

/**
 * 四、国内账号 - 收支日期 - 详细信息
 * 2025-05-25
 * @param params
 */
export const departBalanceData = (params) => defHttp.get({ url: Api.departBalanceData, params}, { isTransformResponse: false });

/**
 * 六、数据清洗
 * 2025-10-25
 * @param params
 */
export const bankBalanceClear = () => defHttp.get({ url: Api.bankBalanceClear}, { isTransformResponse: false });
/**
 * 六、数据清洗
 * 2025-10-25
 * @param params
 */
export const bankBalanceUpdate= (params) => defHttp.get({ url: Api.bankBalanceUpdate, params}, { isTransformResponse: false });

/**
 * 系统对账 - 账号分析
 * @param params
 */
export const findBalanceCheckAnalyse = (params) => defHttp.get({url: Api.findBalanceCheckAnalyse, params});
